<?php

include '../source/config.php';
include '../source/soap.fnc.php';

$soap = start_soap($wsdl_url['MTS']);

$data = $arr = array();
$list = $row = array();

//$areaId = 'AQ';

if($type == 1){
	

	
	//diy号码
	$data['mobileQuery'] = array(
		'agentId'=>$agentId,
		"pageNum"=>$page,
		"pageSize"=>$pageSize,
		"areaId"=>$areaId,
		'customerMobile'=>$num,
	);
	
	//$arr['err'] = 1;
	//$arr['errinfo'] = $type;
	
	

} elseif($type == '2'){
	//AABB号码靓号
	$data['mobileQuery'] = array(
		'agentId'=>$agentId,
		"pageNum"=>$page,
		"pageSize"=>$pageSize,
		"areaId"=>$areaId,
		'tailType'=>$num,
	);
	
} elseif($type == '3'){
	//情侣号码
	$data['mobileQuery'] = array(
		'agentId'=>$agentId,
		"pageNum"=>$page,
		"pageSize"=>10,
		"areaId"=>$areaId,
		'isLove'=>1,
	);
	$result = $soap->getMobiles($data);

	$arr['length'] = $result->PageResult->totalSize; //总数目
	if(!empty($result->PageResult->mobiles)){
		foreach($result->PageResult->mobiles as $val){
			//$row['loveId'] = $val->loveId;
			//$row['phone_code'] = $val->mobile;
			//$row['area_code'] = $val->areaId;
			$tmp[$val->loveId][] = $val->mobile;
		}
		foreach($tmp as $key=>$val){
			$row['phone_code2'] = $val[0];
			$row['phone_code'] = $val[1];
			$row['area_code'] = $areaId;
			$list[] = $row;
		}
	}
	$arr['list'] = $list;
	echo json_encode($arr);die();

} elseif($type == '4'){
	//吉祥号
	$data['mobileQuery'] = array(
		'agentId'=>$agentId,
		"pageNum"=>$page,
		"pageSize"=>$pageSize,
		"areaId"=>$areaId,
		'exactMobile'=>'*'.$num,
	);
} else {
	
die();
	
}

//print_r($data);

$result = $soap->getMobiles($data);
	$arr['length'] = $result->PageResult->totalSize; //总数目

	//print_r($result->PageResult->mobiles);die();
	if(!empty($result->PageResult->mobiles)){
		foreach($result->PageResult->mobiles as $val){
			$row['area_code'] = $val->areaId;
			$row['phone_code'] = $val->mobile;
			$row['area_name'] = $val->areaName;
			$row['phone_id'] = $val->id;
			$row['phone_fee'] = $val->startCost;
			//$row['startCost'] = $val->startCost;//预存款
			$row['minConsumption'] = $val->minConsumption;//保底消费
			$row['lowestFee'] = $val->lowestFee;//最低套餐金额

			$list[] = $row;
		}
	}
	$arr['list'] = $list;
	echo json_encode($arr);



?>